package ar.com.fiuba.ElectronicCircuitAnalyst.domain.impl.functions.exceptions;

/**
 * 
 * @author ngonzalez
 * 
 */
public class InvalidExpressionException extends Exception {

	private static final long serialVersionUID = 1L;

	private Throwable ex;

	/**
	 * Constructs a <code>InvalidExpressionException</code> with no detail message.
	 */
	public InvalidExpressionException() {
		super();
	}

	/**
	 * Constructs a <code>InvalidExpressionException</code> with the specified detail
	 * message.
	 * 
	 * @param s
	 *            the detail message.
	 */
	public InvalidExpressionException(String err) {
		super(err);
	}

	/**
	 * Constructs a new {@code InvalidExpressionException} with the current stack
	 * trace, the specified detail message and the exception that occurred when
	 * trying to validate the rule.
	 * 
	 * @param detailMessage
	 *            the detail message for this exception.
	 * @param exception
	 *            if an exception occurred while validate the rule.
	 */
	public InvalidExpressionException(String detailMessage, Throwable exception) {
		super(detailMessage);
		ex = exception;
	}

	/**
	 * Returns the exception which occurred when loading the class.
	 * 
	 * @return Throwable the exception which occurred while validating the
	 *         class.
	 */
	public Throwable getException() {
		return ex;
	}

	/**
	 * Returns the cause of this Throwable, or {@code null} if there is no
	 * cause.
	 * 
	 * @return Throwable the receiver's cause.
	 */
	@Override
	public Throwable getCause() {
		return ex;
	}

}
